<!--
 * @Description: 
 * @Author: 赵华宇
 * @Date: 2025-04-23 19:43:16
 * @LastEditors: 赵华宇
 * @LastEditTime: 2025-04-23 20:06:32
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清除浮动</title>
    <style>
        /* 单伪元素法 */
        .clearfix::after {
            content: "";
            display: block;
            clear: both;
        }
        .top{
            margin: 10px auto;
            width: 1200px;
            /* height: 300px; */
            background-color: skyblue;
        }
        .left{
            float:left;
            width: 200px;
            height: 300px;
            background-color: pink;
        }
        .right{
            float:right;
            width: 950px;
            height: 300px;
            background-color: orange;
        }
        .bottom{
            height: 100px;
            background-color: brown;
        }
        /* 双伪元素法 */
        .clearfix::before,
        .clearfix::after{
            content:"";
            display:table;
        }
        .clearfix::after{
            clear:both;
        }

        /* .clearfix{
            clear: both;
        } */
    </style>
</head>
<body>
    <div class="top clearfix" >
        <div class="left"></div>
        <div class="right"></div>
        <!-- 额外标签法 清除浮动影响 -->
        <!-- <div class="clearfix"></div> -->
    </div>
    <div class="bottom"></div>
</body>
</html>